import Vue from 'vue'
import App from './App.vue'
import {
  Button, Form, FormItem, Input, Message, Container, Header, Aside, Main, Footer,
  Menu, MenuItemGroup, Submenu, MenuItem, Breadcrumb, BreadcrumbItem, Card, Row, Col
} from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import '@/assets/css/global.css'
import '@/assets/fonts/iconfont.css'

import axios from 'axios'
import VueAxios from 'vue-axios'

import router from '@/router'

Vue.config.productionTip = false
// 请求根路径
axios.defaults.baseURL = 'http://www.ysqorz.top:8888/api/private/v1/'
axios.interceptors.request.use(config => {
  // 请求头中添加token信息
  config.headers.Authorization = window.sessionStorage.getItem('token')
  return config
})

Vue.use(VueAxios, axios)
Vue.use(Button).use(Form).use(FormItem).use(Input).use(Container).use(Header).use(Aside).use(Main).use(Footer)
  .use(Menu).use(MenuItemGroup).use(Submenu).use(MenuItem).use(Breadcrumb).use(BreadcrumbItem).use(Card).use(Row).use(Col)

Vue.prototype.$message = Message

// runtime
new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
